<?php
/**
 * CreateTime: 2023/11/16 15:37
 * User:LinQ
 */

namespace Database\Seeders;

use Database\Seeders\Database\AuthSeeder;
use Database\Seeders\Database\CompanyDepartmentSeeder;
use Database\Seeders\Database\CompanySeeder;
use Database\Seeders\Database\DataMappingSeeder;
use Database\Seeders\Database\DepartmentSeeder;
use Database\Seeders\Database\DepartmentUserSeeder;
use Database\Seeders\Database\RoleAuthSeeder;
use Database\Seeders\Database\RoleSeeder;
use Database\Seeders\Database\UserRoleSeeder;
use Database\Seeders\Database\UserSeeder;
use Database\Seeders\System\PvPuKeySeeder;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Mockery\Exception;

class RunSeeder extends Seeder
{
    public function run()
    {
        DB::beginTransaction();
        try {
            $this->call([
                // 数据生成
                UserSeeder::class,
                CompanySeeder::class,
                AuthSeeder::class,
                RoleSeeder::class,
                RoleAuthSeeder::class,
                UserRoleSeeder::class,
                DepartmentSeeder::class,
                DepartmentUserSeeder::class,
                DataMappingSeeder::class,
                // 系统其它配置文件生成
                PvPuKeySeeder::class,

            ]);
            DB::commit();
        }catch (Exception $exception){
            DB::rollBack();
            throw $exception;
        }
    }
}